<div class="headbar">
	<div class="position">订单<span>></span><span>订单管理</span><span>></span><span>订单列表</span></div>
	<div class="operating">
		<a href="javascript:void(0);"><button class="operating_btn" type="button" onclick="window.location='{url:/order/order_edit}'"><span class="addition">添加订单</span></button></a>
		<a href="javascript:void(0);" onclick="selectAll('id[]')"><button class="operating_btn" type="button"><span class="sel_all">全选</span></button></a>
		<a href="javascript:void(0);" onclick="delModel({form:'orderForm'})"><button class="operating_btn" type="button"><span class="delete">批量删除</span></button></a>
		<a href="javascript:void(0);" onclick="$('#orderForm').attr('action','{url:/order/expresswaybill_template}');$('#orderForm').submit();"><button class="operating_btn"><span class="export">批量打印快递单</span></button></a>
		<a href="javascript:void(0);"><button class="operating_btn" onclick="location.href='{url:/order/print_template}'"><span class="export">单据模板</span></button></a>
		<a href="javascript:void(0);"><button class="operating_btn" type="button" onclick="location.href='{url:/order/order_recycle_list}'"><span class="recycle">回收站</span></button></a>
	</div>
	<div class="searchbar">
		<form action="{url:/}" method="get" name="order_list">
			<input type='hidden' name='controller' value='order' />
			<input type='hidden' name='action' value='order_list' />

			<select name="search[pay_status]" class="auto">
				<option value="">选择支付状态</option>
				<option value="0">未支付</option>
				<option value="1">已支付</option>
			</select>

			<select name="search[distribution_status]" class="auto">
				<option value="">选择发货状态</option>
				<option value="0">未发货</option>
				<option value="1">已发货</option>
				<option value="2">部分发货</option>
			</select>

			<select name="search[status]" class="auto">
				<option value="">选择订单状态</option>
				<option value="1">新订单</option>
				<option value="2">确认订单</option>
				<option value="3">取消订单</option>
				<option value="4">作废订单</option>
				<option value="5">完成订单</option>
				<option value="6">退款</option>
				<option value="7">部分退款</option>
			</select>

			<select class="auto" name="search[name]">
				<option value="">选择订单条件</option>
				<option value="accept_name">收件人姓名</option>
				<option value="order_no">订单号</option>
				<option value="seller_name">商户真实名称</option>
			</select>
			<input class="small" name="search[keywords]" type="text" value="" />
			<button class="btn" type="submit"  onclick='changeAction(false)'><span class="sel">筛 选</span></button>
			<button class="btn" onclick='changeAction(true)'><span class="sel">导出Excel</span></button>
		</form>
	</div>
	<div class="field">
		<table class="list_table">
			<col width="30px" />
			<col width="160px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="115px" />
			<col width="80px" />
			<col />
			<thead>
				<tr>
					<th class="t_c">选择</th>
					<th>订单号</th>
					<th>收货人</th>
					<th>支付状态</th>
					<th>发货状态</th>
					<th>配送方式</th>
					<th>打印</th>
					<th>支付方式</th>
					<th>用户名</th>
					<th>下单时间</th>
					<th>操作</th>
				</tr>
			</thead>
		</table>
	</div>
</div>

<form name="orderForm" id="orderForm" action="{url:/order/order_del}" method="post">
	<div class="content">
		<table class="list_table">
			<col width="30px" />
			<col width="160px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="115px" />
			<col width="80px" />
			<col />
			<tbody>
				{foreach:items = $this->orderHandle->find()}
				<tr>
					<td class="t_c"><input name="id[]" type="checkbox" value="{$item['id']}" /></td>
					<td title="{$item['order_no']}">{$item['order_no']}</td>
					<td title="{$item['accept_name']}">{$item['accept_name']}</td>
					<td><span name="payStatusColor{$item['pay_status']}">{echo:Order_Class::getOrderPayStatusText($item)}</span></td>
					<td><span name="disStatusColor{$item['distribution_status']}">{echo:Order_Class::getOrderDistributionStatusText($item)}</span></td>
					<td title="{$item['distribute_name']}">{$item['distribute_name']}</td>
					<td>
						<span class="prt" title="购物清单打印" onclick="window.open('{url:/order/shop_template/id/$item[id]}');">购</span>
						<span class="prt" title="配货单打印" onclick="window.open('{url:/order/pick_template/id/$item[id]}');">配</span>
						<span class="prt" title="联合打印" onclick="window.open('{url:/order/merge_template/id/$item[id]}');">合</span>
						<span class="prt" title="快递单打印" onclick="window.open('{url:/order/expresswaybill_template/id/$item[id]}');">递</span>
					</td>
					<td>{$item['payment_name']}</td>
					<td>{echo:$item['username']=='' ? '游客' : $item['username']}</td>
					<td title="{$item['create_time']}">{$item['create_time']}</td>
					<td>
						<a href="{url:/order/order_show/id/$item[id]}"><img class="operator" src="{skin:images/admin/icon_check.gif}" title="查看" /></a>
						{if:Order_class::getOrderStatus($item) < 3}
						<a href="{url:/order/order_edit/id/$item[id]}"><img class="operator" src="{skin:images/admin/icon_edit.gif}" title="编辑"/></a>
						{/if}
						<a href="javascript:void(0)" onclick="delModel({link:'{url:/order/order_del/id/$item[id]}'})" ><img class="operator" src="{skin:images/admin/icon_del.gif}" title="删除"/></a>
					</td>
				</tr>
				{/foreach}
			</tbody>
		</table>
	</div>
	{$this->orderHandle->getPageBar()}
</form>

<script type='text/javascript'>
//DOM加载结束
$(function(){
	{if:$this->search}
	var searchData = {echo:JSON::encode($this->search)};
	for(var index in searchData)
	{
		$('[name="search['+index+']"]').val(searchData[index]);
	}
	{/if}

	//高亮色彩
	$('[name="payStatusColor1"]').addClass('green');
	$('[name="disStatusColor1"]').addClass('green');
});
function changeAction(excel)
{
	if (excel){
		$("input[name=\"action\"]").val("order_report");
		$("form[name=\"order_list\"]").attr("target", "_blank");
	}else{
		$("input[name=\"action\"]").val("order_list");
		$("form[name=\"order_list\"]").attr("target", "_self");
	}
}
</script>